package org.dolphin.util;

import java.math.BigDecimal;

public final class Nvl {
  public static BigDecimal nvl(BigDecimal value) {
    return nvl(value, BigDecimal.ZERO);
  }

  public static Boolean nvl(Boolean value) {
    return nvl(value, Boolean.FALSE);
  }

  public static Integer nvl(Integer value) {
    return nvl(value, 0);
  }

  public static String nvl(String value) {
    return nvl(value, "");
  }

  public static <T> T nvl(T value, T defaultValue) {
    return value == null ? defaultValue : value;
  }
}
